package com.anjubao.parking.municipal.roadside.util;

import com.anjubao.parking.municipal.roadside.form.VideoPileForm;
import com.anjubao.parking.municipal.roadside.model.DeviceStatus;
import com.anjubao.parking.municipal.roadside.model.DeviceVideoPile;

public class FormTransfer {
    /**
     * 封装设备实体
     * @param videoPileForm
     * @return
     */
    public static DeviceVideoPile from2DeviceVideoPile(VideoPileForm videoPileForm) {
        DeviceVideoPile deviceVideoPile = new DeviceVideoPile();
        deviceVideoPile.setId(videoPileForm.getDeviceId());
        deviceVideoPile.setCode(videoPileForm.getDeviceCode());
        deviceVideoPile.setMachineNo(videoPileForm.getMachineNo());
        deviceVideoPile.setName(videoPileForm.getDeviceName());
        deviceVideoPile.setType(videoPileForm.getVideoPileType());
        deviceVideoPile.setParkingLotId(videoPileForm.getParkingLotId());
        deviceVideoPile.setParkingLotCode(videoPileForm.getParkingLotCode());
        deviceVideoPile.setParkingLotName(videoPileForm.getParkingLotName());
        deviceVideoPile.setIpAddr(videoPileForm.getIpAddr());
        return deviceVideoPile;
    }

    /**
     * 封装设备状态实体
     * @param videoPileForm
     * @return
     */
    public static DeviceStatus from2DeviceStatus(VideoPileForm videoPileForm) {
        DeviceStatus deviceStatus = new DeviceStatus();
        deviceStatus.setDeviceId(videoPileForm.getDeviceId());
        deviceStatus.setDeviceCode(videoPileForm.getDeviceCode());
        deviceStatus.setDeviceName(videoPileForm.getDeviceName());
        deviceStatus.setDeviceType(2);
        deviceStatus.setIsOnline(videoPileForm.getIsOnline());
        deviceStatus.setStatus(videoPileForm.getDeviceStatus());
        deviceStatus.setRemainingBattery(videoPileForm.getRemainingBattery());
        deviceStatus.setLocation(videoPileForm.getLocation());
        return deviceStatus;
    }

}
